1. Field of the Invention
This invention relates generally to the field of computer graphics and, more particularly, to high performance graphics systems.
2. Description of the Related Art
A graphics system may generate samples in response to received graphics data and filter the samples to generate pixel values. In many conventional graphics systems, the sample filtering operation may be committed to hardware in such a fashion that the filter function (which is applied to the samples) is not readily changeable by the end user. For example, the filter function may be burned into ROM and/or into the structure of a circuit. Thus, the user may not able to adjust the filtering properties to accommodate his/her preferences in visual output quality, to compensate for changing display conditions, to generate special visual effects, etc. Furthermore, many conventional graphics systems may perform sample filtering over a fixed size support region. The end user is not able to select larger regions or smaller regions. For example, larger support regions may be desirable to obtain increased accuracy of reconstruction, and smaller support regions may be desirable to get increased pixel output rate. Thus, there exists a need for a graphical computing system which could filter samples with a programmable filter function and/or a programmable filter support region.
A graphics system may be configured to perform programmable filtering of samples to generate pixel values. The graphics system may comprise a frame buffer, an accelerator unit and a video output processor. The accelerator unit may receive graphics primitives, render samples in response to the graphics primitives, and store the rendered samples into a sample area of the frame buffer. The accelerator unit may subsequently read the samples from the sample area of the frame buffer, and filter the samples with a programmable filter. The resulting pixel values are stored in a pixel area of the frame buffer. The video output processor reads the pixel values from the pixel area and converts the pixel values into a video signal which is provided to a video output port.
In one set of embodiments, the accelerator unit includes a filter weight lookup table and a sample filter unit. The filter weight lookup table may be implemented in RAM and may store filter weights defining the programmable filter. The sample filter unit performs a filtering operation on the samples using filter weights obtained from the filter weight lookup table. The filter weights may be downloaded to the filter weight lookup table from a host software program executing on a host computer (e.g. a system initialization time).
The sample area of the frame buffer may be organized in terms of bins. Each bin stores a set of samples and corresponds to a region (e.g. a square) of the rendering space. Thus, the sample filter may be configured to read a set of bins which cover the support region of the programmable filter centered at a current pixel position. This set of bins may be referred to herein as the bin footprint.
The sample filter may compute normalized square distances for samples in the bin footprint with respect to a current pixel position and determine which of said samples reside interior to the filter support region by comparing said normalized square distances to an upper limit value. The normalized square distance for a given sample may be computed by (i) computing a sum of squares of horizontal and vertical displacements of the given sample with respect to the current pixel position and (ii) multiplying the sum of squares by the reciprocal of the square of a radius of the filter support region. Furthermore, the sample filter may be configured to:
assign a weight value of zero for each sample that resides exterior to the filter support region;
assign a weight value for each sample interior to the filter support region by accessing the filter weight lookup table with the corresponding normalized square distance;
multiply sample attributes (e.g. red, green, blue, xcex1) for each of said samples by the corresponding weight value to obtain weighted sample attributes;
accumulate sums of weighted sample attributes (i.e. one sum per attribute);
accumulate a sum of the weight values associated with the samples; and multiply each of said attribute sums by a reciprocal of the weight sum.
In some embodiments, the accelerator unit may be programmable to perform various types of filtering. For example, in a box filtering mode, the accelerator unit may employ a box filter instead of a circularly symmetric filter. The box filter may have a square support region with programmable radius. The radius is the square support region is defined to be one-half the side length. Samples falling interior to the square support region are assigned the same constant filter weight value (e.g. one). As in the circularly symmetric mode, the sums of weighted sample attributes are normalized by the sum of filter weights.